package com.itheima.thread.阻塞队列.demo2;

import java.util.concurrent.ArrayBlockingQueue;

//厨师线程
public class Cooker extends Thread{
    private ArrayBlockingQueue<String> abq;

    public Cooker(ArrayBlockingQueue<String> abq) {
        this.abq = abq;
    }

    @Override
    public void run() {
        //while (true){
            for (int i = 0; i < 10; i++) {

            try{
                abq.put("汉堡包");
                System.out.println("厨师放入了一个汉堡包");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
